/* Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/*/
$(document).ready(function() {
  // Initialize the jQuery File Upload widget:

  $('#wizard').smartWizard({
    onLeaveStep:leaveAStepCallback,
    onFinish:finishCallback
  });

});

function leaveAStepCallback(obj,context) {
  return validateSteps(context.fromStep);
}

function validateSteps(stepNumber) {
  if (stepNumber == 1) {
    if ( $("input[name='admin_umbrella[category]']:checked").length == 0 ) {
      return false;
    }
    return true;
  } else if ( stepNumber == 2) {
    
  }
  return true;
}

function finishCallback(objs,context) {
  $("#fileupload").submit();
}
